package com.graduation.vaccine.controller;


import com.graduation.vaccine.service.CompanyService;
import com.graduation.vaccine.vo.NearByAddressVo;
import com.graduation.vaccine.vo.RespBean;
import com.graduation.vaccine.vo.VaccinedAddressVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ZhaoJunYao
 * @since 2022-04-13
 */
@RestController
@RequestMapping("/company")
@Api(tags = "部门模块")
public class CompanyController {


    @Autowired
    private CompanyService companyService;

    @ApiOperation("获取该用户所在城市的所有有余量的该疫苗的接种点信息")
    @ResponseBody
    @PostMapping("/getTotalVaccinedAddress")
    public RespBean getTotalVaccinedAddress(@Valid@RequestBody VaccinedAddressVo vaccinedAddressVo){
        return RespBean.success(companyService.getTotalVaccinedAddress(vaccinedAddressVo));
    }

    @ApiOperation("用户附近的接种点信息")
    @ResponseBody
    @PostMapping("/getNearByVaccinedAddress")
    public RespBean getNearByVaccinedAddress(@RequestBody NearByAddressVo nearByAddressVo){
        return companyService.getNearByVaccinedAddress(nearByAddressVo);
    }

}
